package game;

public abstract class StateController {
    protected static GuiAppState guiAppState = new GuiAppState();
    protected static TurnAppState turnAppState = new TurnAppState();
    protected static ResolutionAppState resolutionAppState = new ResolutionAppState();
    
    public static void init() {
        DataStore.stateManager.attach(guiAppState);
        loadTurnState();
    }
    
    public static void turnEnded() {
        DataStore.stateManager.detach(turnAppState);
        loadResolutionState();
    }
    
    public static void resolutionEnded() {
        DataStore.stateManager.detach(resolutionAppState);
        loadTurnState();
    }
    
    private static void loadTurnState() {
        DataStore.stateManager.attach(turnAppState);
        TurnController.nextTurn(); //this line can't moved into TurnAppState until all computer player logic is removed from TurnController
    }
    
    private static void loadResolutionState() {
        DataStore.stateManager.attach(resolutionAppState);
    }

    public static TurnAppState getTurnAppState() {
	return turnAppState;
    }
}
